package com.dy.controller;


import com.dy.entity.Order;
import com.dy.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author dy
 * @since 2022-04-13
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private IOrderService orderService;

    @PostMapping("/insertOrder")
    public boolean insertOrder(@RequestBody Order order){
        if (orderService.save(order)){
            return true;
        }
        return false;
    }

    @GetMapping("/selectOrder")
    public List<Order> selectOrder(){
        return orderService.list();
    }
}
